<%--
    Document   : topfrm
    Created on : Dec 23, 2010, 3:37:16 PM
    Author     : 253913
--%>
<%@page import="java.io.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<HTML>
    <HEAD>
        <TITLE></TITLE>

        <link rel="stylesheet" href="style.css" type="text/css"/>
        <link rel="stylesheet" href="jquery_lib/themes/base/jquery.ui.all.css">
	<script src="jquery_lib/jquery-1.4.4.js"></script>
        <script src="jquery_lib/external/jquery.bgiframe-2.1.2.js"/></script>
	<script src="jquery_lib/ui/jquery.ui.core.js"></script>
	<script src="jquery_lib/ui/jquery.ui.widget.js"></script>
        <script src="jquery_lib/ui/jquery.ui.mouse.js"></script>
	<script src="jquery_lib/ui/jquery.ui.draggable.js"></script>
        <script src="jquery_lib/ui/jquery.ui.resizable.js"></script>
	<script src="jquery_lib/ui/jquery.ui.dialog.js"></script>
        <script src="jquery_lib/ui/jquery.ui.button.js"></script>
	<script src="jquery_lib/ui/jquery.effects.core.js"></script>
	<script src="jquery_lib/ui/jquery.effects.blind.js"></script>
	<script src="jquery_lib/ui/jquery.effects.explode.js"></script>
	<script src="jquery_lib/ui/jquery.ui.accordion.js"></script>
        <script src="jquery_lib/ui/jquery.ui.position.js"></script>
        <script src="jquery_lib/ui/jquery.effects.core.js"></script>
	<script src="jquery_lib/ui/jquery.effects.blind.js"></script>

	<script src="jquery_lib/ui/jquery.effects.bounce.js"></script>
	<script src="jquery_lib/ui/jquery.effects.clip.js"></script>
	<script src="jquery_lib/ui/jquery.effects.drop.js"></script>
	<script src="jquery_lib/ui/jquery.effects.explode.js"></script>
	<script src="jquery_lib/ui/jquery.effects.fold.js"></script>
	<script src="jquery_lib/ui/jquery.effects.highlight.js"></script>

	<script src="jquery_lib/ui/jquery.effects.pulsate.js"></script>
	<script src="jquery_lib/ui/jquery.effects.scale.js"></script>
	<script src="jquery_lib/ui/jquery.effects.shake.js"></script>
	<script src="jquery_lib/ui/jquery.effects.slide.js"></script>

	<script src="jquery_lib/ui/jquery.ui.autocomplete.js"></script>
	<link rel="stylesheet" href="jquery_lib/demos/demos.css">
        <style>
		.result { width: 500px; height: 200px; position: relative; }

		#effect { width: 800px; height: 135px; padding: 0.4em; position: relative; }
		#effect h3 { margin: 0; padding: 0.4em; text-align: center; }
		.ui-effects-transfer { border: 2px dotted gray; }
	</style>
	<script>
	$(function() {
		$( "#accordion" ).accordion({
			fillSpace: true
		});
	});
	

        $(function() {
		var availableTags = [
			"ActionScript",
			"AppleScript",
			"Asp",
			"BASIC",
			"C",
			"C++",
			"Clojure",
			"COBOL",
			"ColdFusion",
			"Erlang",
			"Fortran",
			"Groovy",
			"Haskell",
			"Java",
			"JavaScript",
			"Lisp",
			"Perl",
			"PHP",
			"Python",
			"Ruby",
			"Scala",
			"Scheme"
		];
		$( "#str" ).autocomplete({
			source: availableTags
		});
	});

        // increase the default animation speed to exaggerate the effect
	$.fx.speeds._default = 1000;
	$(function() {
		$( "#dialog" ).dialog({
			autoOpen: false,
                        modal: true,
			show: "clip",
			hide: "explode"
		});
               

		$( "#Search" ).click(function() {
                    if($("#str").val()=="")
			{
                        $( "#dialog" ).dialog( "open" );
			return false;
                        }
		});
	});

        $.fx.speeds._default = 1000;
	$(function() {
		$( "#about" ).dialog({
			autoOpen: false,
                        modal: true,
			show: "clip",
			hide: "bounce"
		});


		$( "#abt" ).click(function() {

                        $( "#about" ).dialog( "open" );
			return false;
                        
		});
	});
        $(function() {
		$( "button, input:submit, a", ".demo" ).button();
		$( "a", ".demo" ).click(function() { return false; });
	});
         
	</script>

    </HEAD>


    <body>

<%        /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/**
 *
 * @author 253913
 */


String SearchString=request.getParameter("str");
System.out.println("Ya am here.. Str = "+SearchString);
if(SearchString==null)
    SearchString="";
//System.exit(0);
if(!SearchString.equals(""))
{
        String dirName = "C:/IR System/doc/";
	   short docType = server.DocumentIterator.TYPE_TEXT;
	   boolean stem = false, feedback = false;
        server.InvertedIndex ii=new server.InvertedIndex(new File(dirName), docType, true, true);
        ii.processQueries(SearchString);

       ///  WithoutInvertedIndex x=new WithoutInvertedIndex();
         //   x.Search(SearchString);


}


%>
<div id="dialog" title="Encyclpedia Message">
	<p>Please enter a search string and then click<b> Search</b> button</p>
</div>
<div id="about" title="About project team">
	<p>Write something about our batch</p
         <img src="d.jpg"/>
</div>

<table align="center" cellpadding="10">
    <tr><td colspan="2">
 
            
</td></tr>
    <tr>
        <td class="class3" colspan="2">
  <h2>Cognizant Encyclopedia</h2>
        </td>
</tr>
<tr>
    <td class="class1" colspan="2">

<form name="form1" id="form1" action="index.jsp">
<div class="demo">

<div class="ui-widget">
    <input id="str" name="str" size=100 value="<%=SearchString%>"/>
        <input type="submit" value="Search" id="Search">
</div>

</div>
<!--<input type="textfield" size=100 align = "center" value="Search" name="str" id="str"> -->

</form>
        <hr/>
        <div class="demo">
<a href="#">An anchor</a>
<a href="#">An anchor</a>
<a href="#">An anchor</a>
<a href="#">An anchor</a>
<button id="abt">About project team</button>
</div>
    </td>
    </tr>
<tr><td class="class2">
     <div id="accordionResizer" style="padding:10px; width:200px; height:500px;" class="ui-widget-content">

<div id="accordion">
	<h3><a href="#">Book 1</a></h3>
	<div>
		<p>SCJP</p>
                <img src="d.jpg"/>
	</div>
	<h3><a href="#">Book 2</a></h3>
	<div>
		<p>SCJP</p>
                <img src="d.jpg"/>
	</div>
	<h3><a href="#">Book 3</a></h3>
	<div>
		<p>SCJP</p>
                <img src="d.jpg"/>
	</div>
	<h3><a href="#">Book 4</a></h3>
	<div>
		<p>SCJP</p>
                <img src="d.jpg"/>
	</div>
        <h3><a href="#">Book 5</a></h3>
	<div>
		<p>SCJP</p>
                <img src="d.jpg"/>
	</div><h3><a href="#">Book 6</a></h3>
	<div>
		<p>SCJP</p>
                <img src="d.jpg"/>
	</div>
</div>


</div>

    </td>

<%
String line="";
BufferedReader in;
int s,s2=1;
if(!SearchString.equals(""))
    {
try {
	    // Open stopword file for reading
	    in = new BufferedReader(new FileReader("C:/IR System/summary.txt"));
	    // Read in stopwords, one per line, until file is empty
             line=in.readLine();
             s2=Integer.parseInt(line);
             s=(s2*180)+135;
             String s1=s+"px";
            %>

            

                <td valign="top">
 <div class="result" style="position:relative;">
     <div id="effect" class="ui-widget-content ui-corner-all" style="height:<%=s1%>;">
		<h3 class="ui-widget-header ui-corner-all">Total Results :<%=line%></h3>

            <%
              // String url="";
	    while ((line = in.readLine()) != null) {
                //url="IR System/doc/";
                %>

                <p class="class2">
                    <a href="<%=line%>"><%=line%></a>
                    <br/>
                    <img src="d.jpg"/>
                    <hr/>
		</p>

                <%

	    }
	    in.close();
            
	}
	catch (IOException e) {
	    System.out.println("\nCould not load results file");

	}

if(s2==0)
    {
%>
 <p class="class2">
                   No Results found for "<%=SearchString%>"
		</p>
<%
}
}
else
{
%>
 <td valign="top">
 <div class="result" style="position:relative;">
 <div id="effect" class="ui-widget-content ui-corner-all">
		<h3 class="ui-widget-header ui-corner-all">Welcome</h3>
                 <p class="class1">
                   Project by CHN10AJ050
		</p>
<%
}
%>
        
        <p class="footer">&copy; Cognizant Technology Solutions &nbsp; |&nbsp;<a href="">Terms &amp; Conditions</a></p>
        <hr/>
	</div>
</div>
</td>

</tr>

</table>

    </body>


</HTML>


